package o;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bumptech.glide.load.ImageHeaderParser;
import com.bumptech.glide.load.ImageHeaderParser.ImageType;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;

public final class rx {
    public static int ˎ(@androidx.annotation.NonNull java.util.List<com.bumptech.glide.load.ImageHeaderParser> r4, @androidx.annotation.Nullable java.io.InputStream r5, @androidx.annotation.NonNull o.ud r6) throws java.io.IOException {
        /* JADX: method processing error */
/*
Error: java.lang.NullPointerException
	at jadx.core.dex.visitors.ssa.SSATransform.placePhi(SSATransform.java:82)
	at jadx.core.dex.visitors.ssa.SSATransform.process(SSATransform.java:50)
	at jadx.core.dex.visitors.ssa.SSATransform.visit(SSATransform.java:42)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
	at jadx.core.ProcessClass.process(ProcessClass.java:37)
	at jadx.core.ProcessClass.processDependencies(ProcessClass.java:59)
	at jadx.core.ProcessClass.process(ProcessClass.java:42)
	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
	at jadx.api.JavaClass.decompile(JavaClass.java:62)
*/
        /*
        r1 = -1;
        if (r5 != 0) goto L_0x0005;
    L_0x0003:
        r0 = r1;
    L_0x0004:
        return r0;
    L_0x0005:
        r0 = r5.markSupported();
        if (r0 != 0) goto L_0x0011;
    L_0x000b:
        r0 = new o.wz;
        r0.<init>(r5, r6);
        r5 = r0;
    L_0x0011:
        r0 = 5242880; // 0x500000 float:7.34684E-39 double:2.590327E-317;
        r5.mark(r0);
        r0 = 0;
        r3 = r4.size();
        r2 = r0;
    L_0x001c:
        if (r2 >= r3) goto L_0x003a;
    L_0x001e:
        r0 = r4.get(r2);
        r0 = (com.bumptech.glide.load.ImageHeaderParser) r0;
        r0 = r0.ˎ(r5, r6);	 Catch:{ all -> 0x0035 }
        if (r0 == r1) goto L_0x002e;
    L_0x002a:
        r5.reset();
        goto L_0x0004;
    L_0x002e:
        r5.reset();
        r0 = r2 + 1;
        r2 = r0;
        goto L_0x001c;
    L_0x0035:
        r0 = move-exception;
        r5.reset();
        throw r0;
    L_0x003a:
        r0 = r1;
        goto L_0x0004;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.rx.ˎ(java.util.List, java.io.InputStream, o.ud):int");
    }

    @androidx.annotation.NonNull
    public static com.bumptech.glide.load.ImageHeaderParser.ImageType ˏ(@androidx.annotation.NonNull java.util.List<com.bumptech.glide.load.ImageHeaderParser> r4, @androidx.annotation.Nullable java.io.InputStream r5, @androidx.annotation.NonNull o.ud r6) throws java.io.IOException {
        /* JADX: method processing error */
/*
Error: java.lang.NullPointerException
	at jadx.core.dex.visitors.ssa.SSATransform.placePhi(SSATransform.java:82)
	at jadx.core.dex.visitors.ssa.SSATransform.process(SSATransform.java:50)
	at jadx.core.dex.visitors.ssa.SSATransform.visit(SSATransform.java:42)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:31)
	at jadx.core.dex.visitors.DepthTraversal.visit(DepthTraversal.java:17)
	at jadx.core.ProcessClass.process(ProcessClass.java:37)
	at jadx.core.ProcessClass.processDependencies(ProcessClass.java:59)
	at jadx.core.ProcessClass.process(ProcessClass.java:42)
	at jadx.api.JadxDecompiler.processClass(JadxDecompiler.java:306)
	at jadx.api.JavaClass.decompile(JavaClass.java:62)
*/
        /*
        if (r5 != 0) goto L_0x0005;
    L_0x0002:
        r0 = com.bumptech.glide.load.ImageHeaderParser.ImageType.UNKNOWN;
    L_0x0004:
        return r0;
    L_0x0005:
        r0 = r5.markSupported();
        if (r0 != 0) goto L_0x0011;
    L_0x000b:
        r0 = new o.wz;
        r0.<init>(r5, r6);
        r5 = r0;
    L_0x0011:
        r0 = 5242880; // 0x500000 float:7.34684E-39 double:2.590327E-317;
        r5.mark(r0);
        r0 = 0;
        r2 = r4.size();
        r1 = r0;
    L_0x001c:
        if (r1 >= r2) goto L_0x003c;
    L_0x001e:
        r0 = r4.get(r1);
        r0 = (com.bumptech.glide.load.ImageHeaderParser) r0;
        r0 = r0.ˏ(r5);	 Catch:{ all -> 0x0037 }
        r3 = com.bumptech.glide.load.ImageHeaderParser.ImageType.UNKNOWN;	 Catch:{ all -> 0x0037 }
        if (r0 == r3) goto L_0x0030;
    L_0x002c:
        r5.reset();
        goto L_0x0004;
    L_0x0030:
        r5.reset();
        r0 = r1 + 1;
        r1 = r0;
        goto L_0x001c;
    L_0x0037:
        r0 = move-exception;
        r5.reset();
        throw r0;
    L_0x003c:
        r0 = com.bumptech.glide.load.ImageHeaderParser.ImageType.UNKNOWN;
        goto L_0x0004;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.rx.ˏ(java.util.List, java.io.InputStream, o.ud):com.bumptech.glide.load.ImageHeaderParser$ImageType");
    }

    @NonNull
    public static ImageType ˎ(@NonNull List<ImageHeaderParser> list, @Nullable ByteBuffer byteBuffer) throws IOException {
        if (byteBuffer == null) {
            return ImageType.UNKNOWN;
        }
        int size = list.size();
        for (int i = 0; i < size; i++) {
            ImageType ˎ = ((ImageHeaderParser) list.get(i)).ˎ(byteBuffer);
            if (ˎ != ImageType.UNKNOWN) {
                return ˎ;
            }
        }
        return ImageType.UNKNOWN;
    }
}
